package com.ys.controller.api.inter;

import com.ys.entity.base.TbFileInfo;
import com.ys.vo.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/api/inter/tbFile")
public class ApiInterFileController {
	private static final Logger logger = LoggerFactory.getLogger(ApiInterFileController.class);

    @RequestMapping("/getTbFileInfo")
	@ResponseBody
	public A getTbFileInfo(HttpServletRequest request,@RequestParam Map<String, Object> params) {
    	try {

			int sourceType = Integer.parseInt(params.get("sourceType").toString());
			long sourceId = Long.parseLong(params.get("sourceId").toString());
			String sourceCode = params.get("sourceCode").toString();

			List<TbFileInfo> fileList = new TbFileInfo().setSourceType(sourceType).setSourceId(sourceId).setSourceCode(sourceCode).queryList();

			return A.suc(fileList);
		}catch (Exception e){
			logger.error("出错：",e.getMessage(),e);
			return A.err("系统获取文件信息出错！");
		}

	}
}
